package com.moefor.clover.init.config;

import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.*;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
@Configuration
@EnableTransactionManagement()
public class TransactionManagerConfig {
	
	@Autowired
	private SessionFactory sessionFactory;
	
	@Bean(name = "transactionManager")
	public HibernateTransactionManager hibernateTransactionManager(){
		HibernateTransactionManager htm = new HibernateTransactionManager();
		htm.setSessionFactory(sessionFactory);
		return htm;
	}
}
